package com.tsx.ai.chat.controller;

import com.tsx.ai.chat.properties.SessionProperties;
import com.tsx.ai.chat.service.ChatSessionService;
import com.tsx.ai.chat.vo.SessionVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequiredArgsConstructor
@RequestMapping("/session")
@Slf4j
public class SessionController {
    private final SessionProperties sessionProperties;

    @GetMapping("/test")
    public void test() {
        System.out.println("sessionProperties = " + sessionProperties);
    }

    private final ChatSessionService chatSessionService;

    /**
     * 新建会话
     */
    @PostMapping
    public SessionVO createSession(@RequestParam(value = "n", defaultValue = "3") Integer num) {
        return this.chatSessionService.createSession(num);
    }

    /**
     * 切换热门问题
     */
    @GetMapping("/hot")
    public List<SessionVO.Example> hotExamples(@RequestParam(value = "n", defaultValue = "3") Integer num) {
        return this.chatSessionService.hotExamples(num);
    }
}
